package com.camel.base.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.camel.core.enums.BaseEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author Administrator
 */

@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum QuestionType  implements BaseEnum {
    /**/
    SINGLE(1, "单选题"), MULTY(2, "多选题"), UNVALID(0, "无效");

    @EnumValue
    private Integer value;

    private String desc;

    QuestionType(Integer code, String desc) {
        this.value = code;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public BaseEnum getEnumByValue(Integer value) {
        for (QuestionType types : QuestionType.values()) {
            if(types.getValue().equals(value)) {
                return types;
            }
        }
        return null;
    }
}
